package com.by.utils;

/**
 * @version 1.0
 * @Author 彭彦彬
 * @Date 2025/4/9 10:59
 * @注释
 */
import java.sql.*;

public class JdbcUtils {
    private static final String URL = "jdbc:mysql://192.168.41.41:3306/handle_framwork";
    private static final String USER = "root";
    private static final String PASSWORD = "1357";

    public static Connection getConnection() throws SQLException {
        return DriverManager.getConnection(URL, USER, PASSWORD);
    }

    public static void close(Connection conn, Statement stmt, ResultSet rs) {
        try {
            if (rs != null) rs.close();
            if (stmt != null) stmt.close();
            if (conn != null) conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}